package com.gzx.qc.modular.inspection.controller;

import com.gzx.qc.modular.inspection.bo.GzxManualQualityInspectionAddBo;
import com.gzx.qc.modular.inspection.bo.GzxManualQualityInspectionQueryBo;
import com.gzx.qc.modular.inspection.service.GzxManualQualityInspectionService;
import com.gzx.qc.modular.inspection.vo.GzxInspectionStatusVo;
import com.gzx.qc.modular.inspection.vo.GzxManualQualityInspectionVo;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import vip.xiaonuo.common.mvc.controller.BaseController;
import vip.xiaonuo.common.pojo.CommonResult;

/**
 * @author xbl
 */
@Slf4j
@RestController
@RequestMapping("/qc/inspection")
public class GzxManualQualityInspectionController extends BaseController<GzxManualQualityInspectionAddBo, GzxManualQualityInspectionVo, GzxManualQualityInspectionQueryBo, GzxManualQualityInspectionService> {

    public GzxManualQualityInspectionController(GzxManualQualityInspectionService baseService) {
        super(baseService);
    }

    /**
     * 获取质检状态
     */
    @GetMapping("/getStatus/{callId}")
    public CommonResult<GzxInspectionStatusVo> getStatus(@PathVariable String callId) {
        return CommonResult.data(baseService.getStatus(callId));
    }

    /**
     * 新增人工质检
     */
    @PostMapping("/insert")
    public CommonResult<Void> insert(@RequestBody GzxManualQualityInspectionAddBo bo) {
        log.info("新增人工质检 {} ", bo);
        baseService.insert(bo);
        return CommonResult.ok();
    }

    /**
     * 人工质检导出
     */
    @RequestMapping("/export")
    public void exportInspectionReport(@RequestBody GzxManualQualityInspectionQueryBo bo, HttpServletResponse response) {
        baseService.exportInspectionReport(bo, response);
    }
}
